/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package chameleon.view.command;

import chameleon.model.AbstractManager;
import chameleon.model.ManagerFactory;
import chameleon.view.input.Input;

/**
 *
 * @author simon
 */
public class BuildModelCmd extends Command {



    public BuildModelCmd(Input input, boolean help){
        super(input,false,help);

    }

    @Override
    public Input execute() {
        if (!help_){
            
            InternalCheckCommand check = new InternalCheckCommand(input_, 1);
            if (check.isOk()){
                if (input_.getSmvFile() == null)
                    outputManager_.displayString("No model are present! Please use "
                            + "command read_model.\n");
                else{
                    AbstractManager manager = ManagerFactory.createManager(input_);
                    manager.createGame();
                    manager.buildGame();
                    input_.setManager(manager);
                }
            }
            
        }
        else{
            outputManager_.displayString("build_model takes no parameter.\n"
                    + "This function initialize the data structure of the model\n");
        }
        return input_;
    }

}
